package com.jixi.controller;

import com.jixi.common.result.PageResult;
import com.jixi.common.result.Result;
import com.jixi.pojo.entity.AuditRecords;
import com.jixi.service.AuditRecordsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/education")
public class AuditRecordsController {
	
	@Autowired
	private AuditRecordsService auditRecordsService;
	
	/**
	 * 审核记录列表
	 *
	 * @param pageNum   页码
	 * @param pageSize  每页数量
	 * @param companyId 餐饮公司id
	 * @param status    审核状态
	 * @return 审核记录列表
	 */
	@GetMapping("/auditRecords/list")
	public Result<PageResult> auditRecordsList(
			Integer pageNum,
			Integer pageSize,
			Long companyId,
			Integer status
	) {
		return auditRecordsService.auditRecordsPage(pageNum,pageSize,companyId,status);
	}
	
	/**
	 * 通过审核记录id查询审核记录详情
	 *
	 * @param auditId 审核记录id
	 * @return 审核记录详情
	 */
	@GetMapping("/auditRecords/info/auditId")
	public Result<AuditRecords> getInfoByAuditId(Long auditId) {
		AuditRecords auditRecords = auditRecordsService.getAuditRecordsByAuditId(auditId);
		return Result.success(auditRecords);
	}
	
	/**
	 * 通过套餐id查询审核记录详情
	 *
	 * @param setmealId 套餐id
	 * @return 审核记录详情
	 */
	@GetMapping("/auditRecords/info/setmealId")
	public Result<AuditRecords> getInfoBySetmealId(Long setmealId) {
		AuditRecords auditRecords = auditRecordsService.getAuditRecordsBySetmealId(setmealId);
		log.info("1223444"+auditRecords);
		return Result.success(auditRecords);
	}
	
}
